/**
 * Copyright (c) [2025] [AGIROS] 
 * [travoddsgen] is licensed under Mulan PSL v2. 
 * You can use this software according to the terms and conditions of the Mulan PSL v2. 
 * You may obtain a copy of Mulan PSL v2 at: 
 *          http://license.coscl.org.cn/MulanPSL2 
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 
 * See the Mulan PSL v2 for more details.
 */ 

#include <iostream>
#include <fstream>
#include <sstream>
#include "ParameterProcessor.h"
#include "IDLParser.h"

int main(int argc, char* argv[]) {
     //// 模拟命令行参数
     //char* argvFake[] = {"program", 
     //"--input", "D:\\travodds\\travoddsgen\\test\\test.idl", 
     //"--output_dir", "output", 
     //"--language", "c",
     //"--include_path", "D:\\jazzy\\build\\builtin_interfaces\\rosidl_adapter"
     //};
     //int argcFake = sizeof(argvFake) / sizeof(argvFake[0]);
     //// Create and validate parameters
     //ParameterProcessor params(argcFake, argvFake);
    ParameterProcessor params(argc, argv);
    try {
        params.validate();
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
        return 1;
    }

    // Parse the IDL file
    IDLParser& driver = IDLParser::getInstance(params);
    SpecificationNode* root = driver.parse(params.get("input"));
    if (!root) {
        return 1;
    }

    printf("visitor finish.\n");
    return 0;
}
